Force pushing on a spec task branch doesn't work. It fail...#1786
Merged
lukemarsden merged 3 commits intomainfrom Mar 2, 2026
Merged
Force pushing on a spec task branch doesn't work. It fail...#1786lukemarsden merged 3 commits intomainfrom
lukemarsden merged 3 commits intomainfrom
Conversation
When an agent force-pushes to their feature branch (e.g., after rebasing), detect this by checking if the old commit is an ancestor of the new commit. If not (force push), propagate the force flag to PushBranchToRemote so the upstream push uses --force. Changes: - detectChangedBranches now returns map[string]bool (branch -> isForce) - Added repoPath parameter for running git merge-base --is-ancestor - Log force push detection with old/new commit hashes - Pass isForce flag to PushBranchToRemote call This allows agents to recover from stuck states by force-pushing after rebasing onto the latest base branch. Spec-Ref: helix-specs@497a41c80:001289_force-pushing-on-a-spec
Reuse pattern from existing codebase - adds IsAncestor() to gitea_git_helpers.go and uses it in detectChangedBranches instead of inline git command. Spec-Ref: helix-specs@d70fa2e18:001289_force-pushing-on-a-spec
This reverts commit b2c7892.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
uhoh force push failed with api-1 | 2026-02-17T07:33:45Z ERR pkg/services/git_repository_service_push.go:98 > [GitPush] FAILED to push to external repository error="PushOu
tOfDate Error: exit status 1 - To https://github.com/helixml/helix\n ! [rejected] feature/001036-we-badly-need-to -> feature/001036-w
e-badly-need-to (non-fast-forward)\nerror: failed to push some refs to 'https://github.com/helixml/helix'\nhint: Updates were rejected because a
pushed branch tip is behind its remote\nhint: counterpart. If you want to integrate the remote changes, use 'git pull'\nhint: before pushing ag
ain.\nhint: See the 'Note about fast-forwards' in 'git push --help' for details.\n - To https://github.com/helixml/helix\n ! [rejected]
feature/001036-we-badly-need-to -> feature/001036-we-badly-need-to (non-fast-forward)\nerror: failed to push some refs to 'https://github.com
/helixml/helix'\nhint: Updates were rejected because a pushed branch tip is behind its remote\nhint: counterpart. If you want to integrate the r
emote changes, use 'git pull'\nhint: before pushing again.\nhint: See the 'Note about fast-forwards' in 'git push --help' for details.\n: To htt
ps://github.com/helixml/helix\n ! [rejected] feature/001036-we-badly-need-to -> feature/001036-we-badly-need-to (non-fast-forward)\ne
rror: failed to push some refs to 'https://github.com/helixml/helix'\nhint: Updates were rejected because a pushed branch tip is behind its remo
te\nhint: counterpart. If you want to integrate the remote changes, use 'git pull'\nhint: before pushing again.\nhint: See the 'Note about fast-
forwards' in 'git push --help' for details.\n\n" auth_type=basic:x-access-token branch=feature/001036-we-badly-need-to external_url=https://gith
ub.com/helixml/helix push_duration=299.292469 repo_id=prj_01kg02vqqyg178c1n2ydscn5fb-helix-4 total_elapsed=312.103003
api-1 | 2026-02-17T07:33:45Z ERR pkg/services/git_http_server.go:610 > Failed to push branch to upstream - rolling back error="failed to push t
o external repository: PushOutOfDate Error: exit status 1 - To https://github.com/helixml/helix\n ! [rejected] feature/001036-we-badl
y-need-to -> feature/001036-we-badly-need-to (non-fast-forward)\nerror: failed to push some refs to 'https://github.com/helixml/helix'\nhint: Up
dates were rejected because a pushed branch tip is behind its remote\nhint: counterpart. If you want to integrate the remote changes, use 'git p
ull'\nhint: before pushing again.\nhint: See the 'Note about fast-forwards' in 'git push --help' for details.\n - To https://github.com/helixml/
helix\n ! [rejected] feature/001036-we-badly-need-to -> feature/001036-we-badly-need-to (non-fast-forward)\nerror: failed to push som
e refs to 'https://github.com/helixml/helix'\nhint: Updates were rejected because a pushed branch tip is behind its remote\nhint: counterpart. I
f you want to integrate the remote changes, use 'git pull'\nhint: before pushing again.\nhint: See the 'Note about fast-forwards' in 'git push -
-help' for details.\n: To https://github.com/helixml/helix\n ! [rejected] feature/001036-we-badly-need-to -> feature/001036-we-badly-
need-to (non-fast-forward)\nerror: failed to push some refs to 'https://github.com/helixml/helix'\nhint: Updates were rejected because a pushed
branch tip is behind its remote\nhint: counterpart. If you want to integrate the remote changes, use 'git pull'\nhint: before pushing again.\nhi
nt: See the 'Note about fast-forwards' in 'git push --help' for details.\n\n" branch=feature/001036-we-badly-need-to repo_id=prj_01kg02vqqyg178c
1n2ydscn5fb-helix-4